package todo;

import java.io.IOException;
import java.net.URLEncoder;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ServletSearchTodo extends HttpServlet {
	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest req, HttpServletResponse resp)
	throws IOException {
		doPost(req, resp);
	}
	public void doPost(HttpServletRequest req, HttpServletResponse resp)
	throws IOException 
	{
		//Utils.checkUser();
		String search = req.getParameter("search");
		if (search == null || search.equals(""))
		{
			resp.sendRedirect("/index.jsp");
		}
		else
		{
			resp.sendRedirect("/index.jsp?search="+URLEncoder.encode(search, "UTF-8"));
		}
	}
}